Skip to main content

All Questions

Tagged with
5votes
1answer
158views

Ackermann-Péter function call count using Writer monad

I'm quite new to Monads and I tried add function call counting to the Ackermann function code. The goal was simplicity, not performance. I want to have code review on the ...
Arpad Horvath's user avatar
4votes
1answer
1kviews

Generate possible combinations by range and length

I am learning Haskell and I implemented a recursive function that generates possible strings by length and array (e.g. ['a'..'z']): ...
Vlad Havriuk's user avatar
3votes
2answers
2kviews

Haskell Function to get the List representation of an Integral

This is a simple practice problem. The task is to write a function getLR that receives an Integral, ...
Moritz Loritz's user avatar
1vote
1answer
58views

Equivalent partition sums

I'm looking for feedback on my solution to the following prompt: Given an array of ints, return the index such that the sum of the elements to the right of that index equals the sum of the elements ...
cgoates's user avatar
1vote
1answer
173views

String tokenizer

Objective: Create a function called wordsAndSpaces that splits a string on groups of spaces, preserving each group of space characters as a single token. Example: <...
cgoates's user avatar
1vote
1answer
252views

"Sequence full of colors" challenge on HackerRank

This is the challenge: You are given a sequence of N balls in 4 colors: red, green, yellow and blue. The sequence is full of colors if and only if all of the ...
Enlico's user avatar
2votes
1answer
169views

Berlekamp–Massey Algorithm in Haskell

I was recently tasked to write an implementation of the Berlekamp–Massey algorithm (for GF2) from a given inductional proof and decided to fresh up on my Haskell, since converting a proof by induction ...
ljrk's user avatar
  • 919
2votes
1answer
142views

Performing an action which may return other actions to be performed, concurrently

I have a program which, at its core, involves repeatedly performing an action on some value, and based on that action also returning a list of new values to perform that action on. The pure version of ...
Izaak Weiss's user avatar
1vote
1answer
4kviews

The quicksort algorithm in Haskell

I am learning Haskell programming language mainly from this source. And there I have encouraged with "an elegant" realization of the quicksort sorting algorithm (the Quick, sort! section). ...
LRDPRDX's user avatar
12votes
1answer
222views

Solving alethic modal logic formulas using truth trees

Disclaimer: this first section is about alethic modal logic and truth trees. It's important to the question but significant parts of the code can probably be reviewed without it. You're welcome to ...
overactor's user avatar
3votes
2answers
299views

Segementing a recursive tree in haskell

Could somebody help me work out how to abstract the recursion from this code for me please? I'm trying to write something that takes a pandoc structure, and subdivides the tree whenever it finds a ...
danbroooks's user avatar
5votes
1answer
467views

Haskell limit number of recursions

I want to create a monad which will prevent more than 10 instances of recursion (which I am implementing by preventing more than 10 instances of >>=). My <...
Xodarap's user avatar
3votes
1answer
278views

Parsing n lines to count vowels - HackerEarth

I have written a haskell program for the following 'Code Monk' Challenge at HackerEarth. Here is the challenge description. Basically, we are looking for the number of vowels in a string. The first ...
Jonathan Chouraki's user avatar
6votes
1answer
18kviews

Filter Duplicate Elements in Haskell

I'm working on HackerRank to try to improve my Haskell skills along side with reading Haskell Programming from first principles. I wrote a program that works, but it seems to time out on large input ...
Eli Sadoff's user avatar
3votes
2answers
163views

Count numbers whose digits are only increasing or decreasing

The goal is described here: basically, it is to compute the number of numbers below \$10^n\$ such that its digits are either increasing or decreasing (like 112 or 211, but not like 121). The original ...
awllower's user avatar

153050per page
close